<template>
	<view class="container">
		<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" :top="50">
			<view >
				<PftItem v-for="(item,index) in list" :key="index" :itemInfo="item"/>
			</view>
		</mescroll-uni>
	</view>
</template>
 
<script>
	import PftItem from './carPftListItem.vue';
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";	
	import { getPreCheckList } from '@/api/carPreFlight.js'
	export default {
		components:{
			PftItem
		},
		props:{
			listType:{type:Number,default:0},
			timestamp:{type:Number/null,default:null}
		},
		mixins: [MescrollMixin],
		data(){
			return {
				list:[]
			}
		},
		methods:{
			downCallback(){
				this.list = []
				this.mescroll.resetUpScroll( true )				
			},
			async upCallback(page){
				// console.log('-----调用了-------')
				let params = {
					pageIndex:page.num,
					pageSize:page.size,
					checkTime:this.timestamp
				}
				let res = await getPreCheckList(params)
				console.log('res',res)
				if(res.result === '1'){
					this.mescroll.endSuccess(res.rows.length)
					this.list = [...this.list,...res.rows]
				} else {
					this.mescroll.endErr()
				}
				this.mescroll.endErr()
			},
		}
	}
	
</script>
<style lang="scss" scoped>
	
</style>